<?php
session_start();
define('IN_ELS', true);

include_once( 'config.php' );
include_once( 'weibooauth.php' );
header("Content-type: text/html; charset=utf-8");

$o = new WeiboOAuth( WB_AKEY , WB_SKEY  );

$keys = $o->getRequestToken();
$aurl = $o->getAuthorizeURL( $keys['oauth_token'] ,false , 'http://local.iknowy.com/lib/apilogin/sinat/callback.php');

$_SESSION['keys'] = $keys;
$_SESSION['web_type'] = "sinat";
$_SESSION['sinatbackurl'] = empty($_GET['sinatbackurl']) ? (empty($_SESSION['sinatbackurl'])?"":$_SESSION['sinatbackurl']) :  $_GET['sinatbackurl'];

header("Location: $aurl");
?>